package cn.highset.modules.activiti.serviceimpl.mybatis;

import cn.highset.common.exception.HighsetException;
import cn.highset.modules.activiti.dao.mapper.ActMapper;
import cn.highset.modules.activiti.service.mybatis.IActService;
import cn.hutool.core.util.StrUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Victor
 */
@Service
public class IActServiceImpl implements IActService {

    @Autowired
    private ActMapper actMapper;

    @Override
    public Integer deleteBusiness(String table, String id) {

        if (StrUtil.isBlank(table) || StrUtil.isBlank(id)) {
            throw new HighsetException("关联业务表名或id为空");
        }
        return actMapper.deleteBusiness(table, id);
    }

    /**
     * 获取 工作流 审批状态
     *
     * @param processKey    流程key
     * @param businessTable 业务表
     * @param tableId       业务表id
     * @return
     */
    @Override
    public Integer getBusinessResult(String processKey, String businessTable, String tableId) {
        return actMapper.getBusinessResult(processKey, businessTable, tableId);
    }
}
